#include #define LED_PIN 2 #define NUM_LEDS 37 #define LED2_PIN 0 #define NUM_LEDS2 100 const int button3 = 3; // the number of the pushbutton pin const int button5 = 4; const int button6 = 5; // the number of the pushbutton pin const int button11 = 6; const int button14 = 7; // the number of the pushbutton pin const int button16 = 8; const int button19 = 9; // the number of the pushbutton pin const int button22 = 10; const int button26 = 11; // the number of the pushbutton pin const int button28 = 12; const int button31 = 13; // the number of the pushbutton pin int A=0; int B=0; int C=0; int D=0; int E=0; int k=0; int l=0; unsigned long t=180000; CRGB leds[NUM_LEDS]; CRGB leds2[NUM_LEDS2]; int whiteBulbs[] = {0, 1, 2, 4,7, 8,9,10,12,13,15,18,20,23,24,25,27,29,30,32,33,34,35}; int redBulbs[]= {17,21}; int whiteButtons[]= {button3, button11, button14, button16, button19, button22}; int redButtons[] = {button5, button6, button26, button28, button31}; void setup() { Serial.begin(9600); FastLED.addLeds(leds, NUM_LEDS); FastLED.addLeds(leds2, NUM_LEDS2); pinMode(button3,INPUT_PULLUP); pinMode(button5,INPUT_PULLUP); pinMode(button6,INPUT_PULLUP); pinMode(button11,INPUT_PULLUP); pinMode(button14,INPUT_PULLUP); pinMode(button16,INPUT_PULLUP); pinMode(button19,INPUT_PULLUP); pinMode(button22,INPUT_PULLUP); pinMode(button26,INPUT_PULLUP); pinMode(button28,INPUT_PULLUP); pinMode(button31,INPUT_PULLUP); // for(int i=0;i<100;i++){ // //digitalWrite(leds2[i],LOW); // leds2[i]=CRGB::Red; // } leds2[0]=CRGB::White; FastLED.show(); leds2[1]=CRGB::White; FastLED.show(); for(int i=0;i<37;i++){ // digitalWrite(leds[i],LOW); leds[i]=CRGB(0,0,0); } FastLED.show(); for (int i = 0; i < 23; i ++ ) { leds[whiteBulbs[i]]=CRGB(255,255,255); } FastLED.show(); for (int i = 0; i < 2; i ++ ) { leds[redBulbs[i]]=CRGB(0,255,0); } FastLED.show(); } void loop() { for (int i=3; i <= 13; i++){ if (digitalRead(i)==LOW) { Serial.println(i); } // Serial.println(i); // Serial.println(digitalRead(i)==LOW); // analogWrite(PWMpin, i); delay(10); } if (digitalRead(button3)==LOW) { leds[3]=CRGB(255,255,255); FastLED.show(); } if (digitalRead(button11)==LOW) { leds[11]=CRGB(255,255,255); FastLED.show(); } if (digitalRead(button14)==LOW) { leds[14]=CRGB(255,255,255); FastLED.show(); } if (digitalRead(button16)==LOW) { leds[16]=CRGB(255,255,255); FastLED.show(); } if (digitalRead(button19)==LOW) { leds[19]=CRGB(255,255,255); FastLED.show(); } if (digitalRead(button22)==LOW) { leds[22]=CRGB(255,255,255); FastLED.show(); } if (digitalRead(button5)==LOW) { leds[5]=CRGB(0,255,0); FastLED.show(); A=1; } if (digitalRead(button6)==LOW) { leds[6]=CRGB(0,255,0); FastLED.show(); B=1; } if (digitalRead(button26)==LOW) { leds[26]=CRGB(0,255,0); leds2[0]=CRGB(0,255,0); FastLED.show(); C=1; } if (digitalRead(button28)==LOW) { leds[28]=CRGB(0,255,0); FastLED.show(); D=1; } if (digitalRead(button31)==LOW) { leds[31]=CRGB(0,255,0); FastLED.show(); E=1; } if (A+B+C+D+E==5){ delay(2500); //for(int i=0;i<37;i++){ //leds[i]=CRGB(255,255,255); A=0; l=1; k=1; } if(k==1){ for(int i=0;i<36;i++){ leds[i]=CRGB(255,255,255); } delay(500); FastLED.show(); delay(500); for(int i=0;i<37;i++){ leds[i]=CRGB(0,0,0); } FastLED.show(); } if(millis()>t && A+B+C+D+E<5 && l==0){ for(int i=0;i<36;i++){ // digitalWrite(leds[i],LOW); leds[i]=CRGB(0,255,0); } FastLED.show(); delay(500); for(int i=0;i<37;i++){ leds[i]=CRGB(0,0,0); } FastLED.show(); delay(500); } }